package jinyilw.swing.visuals.Icomp;

import java.awt.Component;

import javax.swing.JPopupMenu;

import jinyilw.swing.i18n.ICSetting;
import jinyilw.swing.i18n.LanguageChanger;
import jinyilw.swing.i18n.LanguageTools;

public class IPopupMenu extends JPopupMenu implements LanguageChanger
{
	private static final long serialVersionUID = 8036426115068857648L;
	private String languageTag = LanguageTools.languageTag;

	public IPopupMenu()
	{
	}

	public IPopupMenu(String label)
	{
		super(label);
	}

	@Override
	public void changLanguage()
	{
		if (!needChangLanguage())
			return;
		for (Component c : getComponents())
			if (c instanceof LanguageChanger)
				((LanguageChanger) c).changLanguage();
		languageTag = LanguageTools.languageTag;
	}

	@Override
	public boolean needChangLanguage()
	{
		return languageTag != LanguageTools.languageTag
				&& LanguageTools.languageSettingEnable;
	}

	@Override
	public void setICSetting(ICSetting iSetting)
	{

	}

	@Override
	public ICSetting getICSetting()
	{
		return null;
	}

	@Override
	public void updateText(String text)
	{
	}
}
